import java.util.Random;

class demo1 {
    public static void Index() {
        int[] arr=new int[10];
        Random random=new Random();
        for (int i = 0; i < arr.length; i++) {
            arr[i]=random.nextInt();
        }
        System.out.println(arr);
        int MaxNum=MaxNum(arr);
        System.out.println(MaxNum);
    }
//    找出最大值的函数
    public static int MaxNum(int []arr){
        int a=0;
        for (int i = 0; i < arr.length-1; i++) {
            for (int j = 0; j < arr.length-1-i; j++) {
                if (arr[j]>arr[j+1]) {
                    a=arr[j+1];
                    arr[j+1]=arr[j];
                    arr[j]=a;
                }
            }
        }
        return a;
    }
}
